package cn.lzx.lock.service;

import cn.lzx.lock.domain.User;
import cn.lzx.lock.domain.UserJpaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by lizhenxing on 2018/1/9.
 */
@Service
public class UserService {

    @Autowired
    private UserJpaRepository userJpaRepository;


    public void save(User user){
        userJpaRepository.save(user);
    }

    public void update(Long userId,String password){
        userJpaRepository.update(password,userId);
    }

    public User getUser(Long userId){
        return userJpaRepository.getOne(userId);
    }

    public void deleteAll(){
        userJpaRepository.deleteAll();
    }

    public void update(String identity,String password){
        userJpaRepository.update(identity,password);
    }
}
